//旋转字符串,判断相等不相等
public class Test4 {
    public static void main(String[] args) {

        String strB="cdeab";

        String strA ="abcde";

        boolean res = check(strA,strB);
        System.out.println(res);
    }
    //旋转字符串
    public static String rotate(String str){
        /*如果修改字符串,两个办法
        1.用subString截取
        2.把字符串变成字符数组,调整后在变为字符串

                */
        char[] arr = str.toCharArray();
        char first = arr[0];
        for (int i = 1; i < arr.length; i++) {
            arr[i-1]=arr[i];
        }
        arr[arr.length-1]=first;
        String result = new String(arr);
        return result;
    }
    public static boolean check(String strA,String strB){
        for(int i = 0;i<strA.length();i++){
            strA = rotate(strA);
            if(strA.equals(strB)){
                return true;
            }
        }
        return false;
    }
}
